﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Informant.SmsMessaging;
using Informant.Contacts;
using System.Runtime.Serialization;
using Informant.Services.Models.Contacts;

namespace Informant.Services.Models.SmsMessaging
{
	[DataContract(Name = "Sms")]
	public class SmsServiceModel : ISms
	{
		/// <summary>
		/// Gets or sets the Sms id.
		/// </summary>
		/// <value>The Sms id.</value>
		[DataMember]
		public String Id { get; set; }
		/// <summary>
		/// Gets or sets a value indicating whether this instance is read.
		/// </summary>
		/// <value><c>true</c> if this instance is read; otherwise, <c>false</c>.</value>
		[DataMember]
		public Boolean IsRead { get; set; }
		/// <summary>
		/// Gets or sets the messages.
		/// </summary>
		/// <value>The messages.</value>
		public IEnumerable<IMessage> Messages
		{
			get { return ServiceModelMessages.Select(message => (IMessage)message); }
			set { ServiceModelMessages = value.Select(message => (MessageServiceModel)message); }
		}
		/// <summary>
		/// Gets or sets the messages.
		/// </summary>
		/// <value>The messages.</value>
		[DataMember(Name="Messages")]
		public IEnumerable<MessageServiceModel> ServiceModelMessages { get; set; }
		/// <summary>
		/// Gets or sets the recipients.
		/// </summary>
		/// <value>The recipients.</value>
		public IEnumerable<IPhone> Recipients
		{
			get { return ServiceModelRecipients.Select(phone => (IPhone)phone); }
			set { ServiceModelRecipients = value.Select(phone => (PhoneServiceModel)phone); }
		}
		/// <summary>
		/// Gets or sets the recipients.
		/// </summary>
		/// <value>The recipients.</value>
		[DataMember(Name="Recipients")]
		public IEnumerable<PhoneServiceModel> ServiceModelRecipients { get; set; }
		/// <summary>
		/// Gets the sender.
		/// </summary>
		/// <value>The sender.</value>
		public IPhone Sender
		{
			get { return ServiceModelSender; }
			set { ServiceModelSender = (PhoneServiceModel)value; }
		}
		/// <summary>
		/// Gets the sender.
		/// </summary>
		/// <value>The sender.</value>
		[DataMember(Name="Sender")]
		public PhoneServiceModel ServiceModelSender { get; set; }
	}
}
